package cn.smbms.service.impl;

import cn.smbms.dao.UserMapper;
import cn.smbms.pojo.Role;
import cn.smbms.pojo.User;
import cn.smbms.service.UserService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

@Service
public class UserServiceImpl implements UserService {
    @Autowired
    private UserMapper userDao;
    @Override
    public String userLogin(String userCode, String userPassword) {
        String userName = userDao.login(userCode,userPassword);
        return userName;
    }

    @Override
    public List<User> queryAll(String userName,int userRole,int beginIndex, int pageSize) {
        List <User> list = userDao.queryAll(userName,userRole,beginIndex,pageSize);
        return list;
    }

    @Override
    public String checkUserCode(String userCodes) {
        String userCode = userDao.checkUserCode(userCodes);
        return userCode;
    }

    @Override
    public int totalRecode(String userName,int userRole) {
        return userDao.totalRecode(userName,userRole);
    }

    @Override
    public List<Role> showRoleNameInfo() {
        List<Role> list = userDao.showRoleNameInfo();
        return list;
    }

    @Override
    public List<User> showByIdUserInfo(String id) {
        List<User> list = userDao.showByIdUserInfo(id);
        return list;
    }

    @Override
    public int updateByIdUserInfo(User user) {

        return userDao.updateByIdUserInfo(user);
    }
}
